/**
 * 公共模块
 */
export default {
  state: {
    auth: null,
    ossPolicy: null,
    photoData: {
      id: 1001,
      /** 图片分组 */
      grouping: [
        {
          id: 1000,
          label: '全部',
          children: [{ id: 1001, label: '默认组', children: [] }]
        }
      ]
    }
  },
  mutations: {
    login(state, auth) {
      state.auth = auth;
    },
    ossPolicy(state, ossPolicy) {
      state.ossPolicy = ossPolicy;
      console.log('state.ossPolicy', state.ossPolicy)
    },
    photoData(state, photoData) {
      state.photoData = photoData;
    }
  },
  getters: {
    getToken: state => {
      return state.auth;
    },
    /** 获取授权值 */
    getAuthorization: state => {
      // return state.auth.tokenType + " " + state.auth.value;
      return state.auth
    },
    getOssPolicy: state => {
      return state.ossPolicy;
    },
    /** 获取图片组件本地数据 */
    getPhotoData: state => {
      return state.photoData;
    }
  }
};
